package web.com.controller;

import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;
import net.fortuna.ical4j.model.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import web.com.IcsUtile.IcsMail;
import web.com.entity.vo.MeetingVo;


/**
 * @author shine
 * 创建时间2022/8/5 15:56
 * @Description
 */
@Api(tags = "test")
@RestController
@AllArgsConstructor
@RequestMapping("/test")
public class IcsMailController {

    @Autowired
    IcsMail icsMail;

    @GetMapping("/icsTest")
    public void icsTest() {
        String name = "38519040@qq.com";                //发送用户邮箱
                         //发送用户密码
        String username = "shinewang@aslcn.com.cn";        //接收用户邮箱
        final String UID = "xingandlch963";

        MeetingVo meetingVo = new MeetingVo();
        meetingVo.setSendAddr(name);
        meetingVo.setStartTime(new Date());
        meetingVo.setEndTime(new Date());
        meetingVo.setLocation("人民大会堂--百花厅");
        meetingVo.setReciveAddr(username);
        meetingVo.setUid(UID);
        meetingVo.setSubject("快来开会啦");
        meetingVo.setContent("xxx邀请您共商大计");
        try {
            icsMail.sendMeeting(meetingVo);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
